
(1)

@)chk . 0  OK.0
@)words
 TOOLS\       MANY         SEE          MSEE         DECOM        >NFA
 DUMP         IWORDS       WORDS        .S           .CH          STOP?
 NOFORTH      V:           C:           BN           DM           HX
 MS           POSTPONE     [']          DOES>        FFBASE       IMMEDIATE
 END-CODE     ;            +LOOP        LOOP         ?DO          DO
 REPEAT       ELSE         AGAIN        UNTIL        BEGIN        THEN
 ?PAIR        WHILE        AHEAD        IF           ADR          INCR
 +TO          TO           CODE         VALUE        VARIABLE     CONSTANT
 :            ALLOT        \            CH           [CHAR]       '
 EVALUATE     COLD         S?          (39) OK.0

(2)

@)\ Commacode for assembler-less programs  OK.0
@)  OK.0
@): COMMACODE ( -- )  ok.2
  created lfa>n count hx 1F and  ok.2
  cr ." code " 2dup type  ok.2
  3 spaces  ok.2
  + aligned >body  ok.2
  chere over - 2/ 0  ok.2
  do @+ u. ." , "  ok.4
     dup 7 and 0=  ok.4
     if cr else space then  ok.4
  loop drop ." end-code " cr ;  OK.0
@)  OK.0
@)\ End   OK.0
@)code INTERRUPT-ON       #8 sr bis  next  end-code  INTERRUPT-ON is not new  OK.0
@)commacode
code INTERRUPT-ON   D232 ,
4F00 ,  end-code
 OK.0
@)code INTERRUPT-OFF      #8 sr bic  next  end-code  INTERRUPT-OFF is not new  OK.0
@)commacode
code INTERRUPT-OFF   C232 ,  4F00 ,
end-code
 OK.0
@)  OK.0
@)code RCBIT-IN       ( -- )              \ Read, decode and collect RC-bits  RCBIT-IN is not new  OK.2
@)    dm 880 #  172 & mov                 \ Next half period in 880 us  OK.2
@)\ ) #4  29 & .b bic                     \ Trace point P2.2 low  OK.2
@)    #1  adr rc# & add                   \ Increase half-bit counter  OK.2
@)    #1  adr rc# & bit  cc? if,          \ Test even bits  OK.4
@)        day push                        \ Save help register  OK.4
@)        adr rcdata &  day mov           \ Copy of low bit in day  OK.4
@)        #1  28 & .b bit                 \ Read input P2.0 to carry  OK.4
@)        #0  day addc                    \ Add carry to previous half-bit  OK.4
@)        #1  day bit  cs? if,            \ Bit pattern valid (uneven) 1/0 or 0/1?  OK.6
@)            1C #  adr rc# & cmp  =? if, \ All 14 (28 half)bits collected?  OK.8
@)                adr rcdata &  day mov   \ Copy data  OK.8
@)                07C0 #  day and>        \ Only valid address bits needed  OK.8
@)                rctype # day cmp  =? if, \ My address?  OK.:
@)                    #-1  adr rckey? & mov \ Yes, command valid!  OK.:
@)                    #1  2B & .b bic     \ Reset HW interrupt flag  OK.:
@)                    #1  2D & .b bis     \ HW interrupt on  OK.:
@)                    #0  160 & mov       \ Stop timer  OK.:
@)                then,  OK.8
@)            then,  OK.6
@)        else,                           \ Invalid pattern, restart!  OK.6
@)            #1  2B & .b bic             \ Reset HW interrupt flag  OK.6
@)            #1  2D & .b bis             \ HW interrupt on  OK.6
@)            #0  160 & mov               \ Stop timer  OK.6
@)        then,  OK.4
@)        rp )+ day mov                   \ Restore original day  OK.4
@)    else,  OK.4
@)        #1  28 & .b bit                 \ Read input P2.0  OK.4
@)        adr rcdata & adr rcdata & addc  \ Save first half-bit  OK.4
@)    then,  OK.2
@)\ ) #4  29 & .b bis                     \ Trace point P2.2 high  OK.2
@)    reti  OK.2
@)end-code  OK.0
@)commacode
code RCBIT-IN   40B2 ,  370 ,
172 ,  5392 ,  244 ,  B392 ,
244 ,  2C24 ,  1208 ,  4218 ,
242 ,  B3D2 ,  28 ,  6308 ,
B318 ,  2814 ,  90B2 ,  1C ,
244 ,  200F ,  4218 ,  242 ,
F038 ,  7C0 ,  9038 ,  0 ,
2008 ,  43B2 ,  246 ,  C3D2 ,
2B ,  D3D2 ,  2D ,  4382 ,
160 ,  3C06 ,  C3D2 ,  2B ,
D3D2 ,  2D ,  4382 ,  160 ,
4138 ,  3C05 ,  B3D2 ,  28 ,
6292 ,  242 ,  242 ,  1300 ,
end-code
 OK.0
@)  OK.0
@)code RCSTART        ( -- )          \ Edge noticed, start decoder!  RCSTART is not new  OK.2
@)    #0  adr rckey? & cmp  =? if,  OK.4
@)        #1 2D & .b bic              \ Stop hardware interrupt  OK.4
@)        dm 430 #  172 & mov         \ Set time to first sample, 430 us (~0,43 ms  OK.4
@)        02D4 #  160 & mov           \ Start timer  OK.4
@)        #1  adr rc# & mov           \ Fake half received bit,  OK.4
@)        #1  adr rcdata & mov        \ Fake bit is high!  OK.4
@)    then,  OK.2
@)    #1  2b & .b bic                 \ Reset HW interrupt flag  OK.2
@)    reti  OK.2
@)end-code  OK.0
@)commacode
code RCSTART   9382 ,  246 ,
200C ,  C3D2 ,  2D ,  40B2 ,
1AE ,  172 ,  40B2 ,  2D4 ,
160 ,  4392 ,  244 ,  4392 ,
242 ,  C3D2 ,  2B ,  1300 ,
end-code
 OK.0
 
 (3)
 
@)cold
noForth C2553 Lp.0 151012
 OK.0
@) words
 RC-TEST      RC-POWER     RC-LAMP      RCKEY        RC-OFF       RC-ON
 RCSTART      RCBIT-IN     INTERRUPT-OFF
 INTERRUPT-ON RCKEY?       RC#
 RCDATA       RCTYPE       FLASH        POWER        LAMP         GREEN
 RED          >LEDS        ASM\         JMP          WHILE,       REPEAT,
 AGAIN,       UNTIL,       ELSE,        AHEAD,       THEN,        BEGIN,
 IF,          JCODE        ?COND        NEVER        <EQ?         >?
 POS?         U>?          U<EQ?        CC?         (28) OK.0
@)chk . -159F  OK.0
@)words

(4)

@)rc-off  OK.0
@)asm\  OK.0
@)words
 ASM\         JMP          WHILE,       REPEAT,      AGAIN,       UNTIL,
 ELSE,        AHEAD,       THEN,        BEGIN,       IF,          JCODE
 ?COND        NEVER        <EQ?         >?           POS?         U>?
 U<EQ?        CC?          CS?          <>?          =?           NEXT
 AND>         XOR>         BIS          BIC          BIT          DADD
 CMP          SUB          SUBC         ADDC         ADD          MOV
 CALL         PUSH         SXT          RRA          SWPB         RRC
 RETI         2OP          1OP          ,,,          SRC          DST
 PREP         EXT2         EXT1         EXT?         &            #8
 #4           #1           #-1          #2           #0           .B
 -)           #            )+           )            X)           NXT
 DOX         (43) OK.0
@)chk . 0  OK.0
@)